{
  ============================================================================
  Akeeba Remote Control
  A GUI for the Akeeba Backup JSON API
  Copyright (C)2008-2010 Nicholas K. Dionysopoulos / Akeeba Developers

  Akeeba Remote Control is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  ============================================================================
}

unit umainform;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
  ExtCtrls, ComCtrls, StdCtrls, ActnList, Buttons;

type

  { TfrmMainForm }

  TfrmMainForm = class(TForm)
     aclAllActions: TActionList;
     actFileQuit: TAction;
     actSiteAddSite: TAction;
     actSiteEditSelectedSite: TAction;
     actHelpContents: TAction;
     actHelpAbout: TAction;
     actSiteManageBackups: TAction;
     actSiteViewLog: TAction;
     actSiteOpenDownloadFolder: TAction;
     actSiteDeleteSelectedSite: TAction;
     actBackupSelectedSite: TAction;
     actBackupAllSites: TAction;
     actAbortCurrentJob: TAction;
     actAbortAllJobs: TAction;
     actOptionsPreferences: TAction;
     btnAddSite: TBitBtn;
     btnBackupAll: TBitBtn;
     btnEditSite: TBitBtn;
     btnAbortAll: TBitBtn;
     btnBackup: TBitBtn;
     btnAbort: TBitBtn;
     ilsMain: TImageList;
     lbxLog: TListBox;
     lsvSiteList: TListView;
     MenuItem1: TMenuItem;
     mmiLanguage: TMenuItem;
     pmiDeleteSelectedSite: TMenuItem;
     pmiSpacer1: TMenuItem;
     pmiBackupSelectedSite: TMenuItem;
     pmiSpacer0: TMenuItem;
     pmiEditSelectedSite: TMenuItem;
     mmiDeleteSelectedSite: TMenuItem;
     mmiViewLog: TMenuItem;
     mmiOpenDownloadFolder: TMenuItem;
     mmiSpacer3: TMenuItem;
     mmiManageBackups: TMenuItem;
     mmiSpacer2: TMenuItem;
     mmiEditSelectedSite: TMenuItem;
     mmiAddSite: TMenuItem;
     mmiQuit: TMenuItem;
     mmiAbortAllJobs: TMenuItem;
     mmiAbortCurrentJob: TMenuItem;
     mmiSpacer1: TMenuItem;
     mmiBackupAllSites: TMenuItem;
     mmiBackupSelectedSite: TMenuItem;
     mmiSites: TMenuItem;
     mmiHelpContents: TMenuItem;
     mmiSpacer0: TMenuItem;
     mmiBackup: TMenuItem;
     mmiPreferences: TMenuItem;
     mmiOptions: TMenuItem;
     mmiAbout: TMenuItem;
     mmiHelp: TMenuItem;
     mmiFile: TMenuItem;
     mmMainMenu: TMainMenu;
     pnlMainBox: TPanel;
     pnlLeft: TPanel;
     pnlBottomBar: TPanel;
     pnlSpacer0: TPanel;
     pnlTopToolbar: TPanel;
     pumSiteListMenu: TPopupMenu;
     sbStatusBar: TStatusBar;
     Splitter1: TSplitter;
     Splitter2: TSplitter;
     procedure actFileQuitExecute(Sender: TObject);
     procedure actHelpAboutExecute(Sender: TObject);
     procedure actOptionsPreferencesExecute(Sender: TObject);
     procedure actSiteAddSiteExecute(Sender: TObject);
     procedure actSiteEditSelectedSiteExecute(Sender: TObject);
     procedure btnAddSiteClick(Sender: TObject);
     procedure btnEditSiteClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  frmMainForm: TfrmMainForm;

implementation

uses
   uaddsitewizard, usiteeditor, upreferences, uaboutform;

{$R *.lfm}

{ TfrmMainForm }

procedure TfrmMainForm.actFileQuitExecute(Sender: TObject);
begin
   Close;
end;

procedure TfrmMainForm.actHelpAboutExecute(Sender: TObject);
begin
   try
      frmAbout := TfrmAbout.Create(Application);
      frmAbout.ShowModal;
   finally
      FreeAndNil(frmAbout);
   end;
end;

procedure TfrmMainForm.actOptionsPreferencesExecute(Sender: TObject);
begin
   try
      frmPreferences := TfrmPreferences.Create(Application);
      frmPreferences.ShowModal;
   finally
      FreeAndNil(frmPreferences);
   end;
end;

procedure TfrmMainForm.actSiteAddSiteExecute(Sender: TObject);
begin
   try
      frmAddSiteWizard := TfrmAddSiteWizard.Create(Application);
      frmAddSiteWizard.ShowModal;
   finally
      FreeAndNil(frmAddSiteWizard);
   end;
end;

procedure TfrmMainForm.actSiteEditSelectedSiteExecute(Sender: TObject);
begin
   try
      frmSiteEditor := TfrmSiteEditor.Create(Application);
      frmSiteEditor.ShowModal;
   finally
      FreeAndNil(frmSiteEditor);
   end;
end;

procedure TfrmMainForm.btnAddSiteClick(Sender: TObject);
begin
   actSiteAddSiteExecute(Self);
end;

procedure TfrmMainForm.btnEditSiteClick(Sender: TObject);
begin
   actSiteEditSelectedSiteExecute(Self);
end;

end.

